#include"progressBar.h"

//模拟从网络上下载文件：
//表示网络带宽(以"x*10s"为单位)：
double bandwidth =0.1*1024*1024;
void download(double filesize)
{
   //表示当前进度：
   double current = 0.0;

   while(current <= filesize)
   {
      progBar(filesize, current);
      //从网络中拉取数据：
      current += bandwidth;
      usleep(100000);
   }
   printf("\n");
   printf("download end, filesize: %.2lf\n", filesize);
}

int main()
{
#ifdef v1
   progBar();
#else
   download(10*1024*1024);
   //download(30*1014*1024);
   //download(1*1024*1024);
   //download(19.87*1024*1024);
#endif
   return 0;
}
